package co.com.fperez.navegar;

import java.io.FileInputStream;
import java.util.Properties;
import java.util.Set;
import java.util.Map.Entry;

public class MiProperties extends Properties {

	private static final long serialVersionUID = -4393618555311366416L;
	
	private static MiProperties miProperties = null ;
	private String rutaProxy = null;
	
	private MiProperties() {
		
	}
	
	public MiProperties getInstance() {
		return miProperties;
	}
	
	public static MiProperties getInstance(String rutaProxy) throws Exception {
		if( miProperties == null ) {
			miProperties = new MiProperties();
			miProperties.configure(rutaProxy);
			miProperties.load( new FileInputStream( rutaProxy ) );
		}
		return miProperties;
	}
	
	private void configure(String newRutaProxy) {
		miProperties.setRutaProxy( newRutaProxy );
	}
	
	public String getRutaProxy() {
		return rutaProxy;
	}

	public void setRutaProxy(String rutaProxy) {
		this.rutaProxy = rutaProxy;
	}
	
	public  Set<Entry<Object, Object>> getProxyList() {
		return miProperties.entrySet();
		
	}
}
